//
//  Macros.h
//  MobileProject 常见的配置项
//
//  Created by wujunyang on 16/1/5.
//  Copyright © 2016年 gfeng. All rights reserved.
//

#define cellId_WL     [NSString stringWithFormat:@"%@cellSection%ldrow%ld",self.class,(long)indexPath.section,(long)indexPath.row]
#define cellId_wl_ind(k)     [NSString stringWithFormat:@"%@cellSection%ldrow%ld%@",self.class,(long)indexPath.section,(long)indexPath.row,k]


#define __WEAK_SELF_YLSLIDE     __weak typeof(self) weakSelf = self;
#define __STRONG_SELF_YLSLIDE   __strong typeof(weakSelf) strongSelf = weakSelf;


//判断是用户是否开启推送权限
#define isPushOpen !([[UIApplication sharedApplication] currentUserNotificationSettings].types  == UIRemoteNotificationTypeNone)

//导航栏高度
#define NavigateHight           [[UIApplication sharedApplication] statusBarFrame].size.height + self.navigationController.navigationBar.frame.size.height


// MainScreen Height&Width
#define Main_Screen_Height      [[UIScreen mainScreen] bounds].size.height
#define Main_Screen_Width       [[UIScreen mainScreen] bounds].size.width
#define Main_Screen_Proportion  ([[UIScreen mainScreen] bounds].size.width／[[UIScreen mainScreen] bounds].size.height)
#define Main_Screen_Bounds      [[UIScreen mainScreen] bounds]

#define Screen_Max_Length (MAX(Main_Screen_Width, Main_Screen_Height))
#define Screen_Min_Length (MIN(Main_Screen_Width, Main_Screen_Height))

#define keyWindow_wl            [UIApplication sharedApplication].keyWindow


//返回图片
#define img(name) [UIImage imageNamed:name]
#define img_original(name)[img(name) imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)]

#define WLRM(x,y,w,h) CGRectMake(x, y, w, h)
#define WLSM(w,h) CGSizeMake(w, h)
#define WLPM(x,y) CGPointMake(x, y)

// 字体大小(常规/粗体)
#define Main_BFont_Size(FONTSIZE)   [UIFont boldSystemFontOfSize:FONTSIZE]
#define Main_Font_Size(FONTSIZE)    [UIFont systemFontOfSize:FONTSIZE]
#define Main_Font(NAME, FONTSIZE)   [UIFont fontWithName:(NAME) size:(FONTSIZE)]


// 是否IOS8
#define isIOS10                  ([[[UIDevice currentDevice]systemVersion]floatValue] >= 10.0)
// 是否iPad
#define isPad                   (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)


//状态栏加载网络请求的小菊花
#define showNetWork_WL [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
#define clossNetWork_WL [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

//色值
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)
#define A(a) RGBA(0,0,0,a)
#define HexColor(hex)            [UIColor colorWithHexString:hex]


//各种数据类型转字符串
#define string(FORMAT,...) [NSString stringWithFormat:FORMAT,__VA_ARGS__]

//字符串是否为空
#define kStringIsEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
//数组是否为空
#define kArrayIsEmpty(array) (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)
//字典是否为空
#define kDictIsEmpty(dic) (dic == nil || [dic isKindOfClass:[NSNull class]] || dic.allKeys == 0)

//是否是空对象
#define kObjectIsEmpty(_object) (_object == nil \
|| [_object isKindOfClass:[NSNull class]] \
|| ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) \
|| ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0))


//  主要单例
#define UserDefaults_wl                        [NSUserDefaults standardUserDefaults]
#define NotificationCenter_wl                  [NSNotificationCenter defaultCenter]
#define SharedApplication_wl                   [UIApplication sharedApplication]


#ifdef DEBUG
#define SSLog(FORMAT, ...) \
fprintf(stderr,"[%s][%d]======>%s\n",\
__func__,\
__LINE__,\
[[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]\
);
#else
#define SSLog(FORMAT,...)
#endif



